<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="Layuimini/lib/layui-v2.6.3/css/layui.css"  media="all">
    <link rel="stylesheet" href="Layuimini/css/public.css"  media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>

<div class="layui-form layuimini-form">

    <input  type="hidden" name="id" th:value="${id}">
    <div class="layui-form-item">
        <label class="layui-form-label required">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="superName"  lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入姓名" value="" th:value="${name}" class="layui-input">
            <tip>填写员工的姓名。</tip>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="superSex" value="男"  th:checked="${sex=='男'}" title="男">
            <input type="radio" name="superSex" value="女"  th:checked="${sex=='女'}" title="女">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">年龄</label>
        <div class="layui-input-block">
            <input type="number" name="superAge"  lay-verify="required" lay-reqtext="年龄" placeholder="请输入年龄" value="" th:value="${age}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">手机</label>
        <div class="layui-input-block">
            <input type="number" name="superMobile" lay-verify="required" lay-reqtext="手机不能为空" placeholder="请输入手机" value="" th:value="${iphone}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input type="email" name="superEmail" placeholder="请输入邮箱" value="" th:value="${email}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">薪资</label>
        <div class="layui-input-block">
            <input type="number" name="superSalary" placeholder="请输入薪资" value=""  th:value="${salary}" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">身份证</label>
        <div class="layui-input-block">
            <input type="number" name="superIdCard" placeholder="请输入薪资" value=""  th:value="${superIdCard}" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">生肖</label>
        <div class="layui-input-block">
            <!--<input type="text" name="superZodiac" placeholder="请输入薪资" value=""  th:value="${superZodiac}" class="layui-input">-->
            <select name="superZodiac">
                <option th:value="${superZodiac}" th:text="${superZodiac}"></option>
                <option value="鼠">鼠</option>
                <option value="牛">牛</option>
                <option value="虎">虎</option>
                <option value="兔">兔</option>
                <option value="龙">龙</option>
                <option value="蛇">蛇</option>
                <option value="马">马</option>
                <option value="羊">羊</option>
                <option value="猴">猴</option>
                <option value="鸡">鸡</option>
                <option value="狗">狗</option>
                <option value="猪">猪</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">星座</label>
        <div class="layui-input-block">
            <!--<input type="text" name="constellation" placeholder="请输入薪资" value=""  th:value="${constellation}" class="layui-input">-->
            <select name="constellation">
                <option th:value="${constellation}" th:text="${constellation}"></option>
                <option value="白羊座">白羊座 &ensp;[3.21-4.19]</option>
                <option value="金牛座">金牛座 &ensp;[4.20-5.20]</option>
                <option value="双子座">双子座 &ensp;[5.21-6.21]</option>
                <option value="巨蟹座">巨蟹座 &ensp;[6.22-7.22]</option>
                <option value="狮子座">狮子座 &ensp;[7.23-8.22]</option>
                <option value="处女座">处女座 &ensp;[8.23-9.22]</option>
                <option value="天秤座">天秤座 &ensp;[9.23-10.23]</option>
                <option value="天蝎座">天蝎座 &ensp;[10.24-11.22]</option>
                <option value="射手座">射手座 &ensp;[11.23-12.21]</option>
                <option value="摩羯座">摩羯座 &ensp;[12.22-1.19]</option>
                <option value="水平座">水平座 &ensp;[1.20-2.18]</option>
                <option value="双鱼座">双鱼座 &ensp;[2.19-3.20]</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
           <!-- <input name="address" class="layui-textarea" th:value="${address}" placeholder="请输入地址"></input>-->
            <textarea name="superAddress" class="layui-textarea" th:utext="${address}" placeholder="请输入地址">

            </textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>
<script  src="LightYear/js/jquery.min.js"  charset="utf-8"></script>
<script  src="Layuimini/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form','table'], function () {
        var form = layui.form,
            layer = layui.layer,
            table = layui.table;
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            console.log(data.field);
            var id = data.field.id;
            form.render(); //更新全部 如果切换页面了感觉无所谓

            this.disabled=true;//防止按钮重复提交
            //保存操作
            $.ajax({
                url:"superTable/editInfoById/"+id,
                type:"POST",
                data:data.field,
                contentType: 'application/json; charset=UTF-8',
                async:false,
                dataType:'json',
                data:JSON.stringify(data.field),
                success:function(result){
                    //console.log(result);
                    layer.msg('保存成功！',{
                        time:2000
                    },function(){
                        window.parent.location.reload();  //刷新父页面
                    })

                }
            });



            /*var index = layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            }, function () {
                // 关闭弹出层
                layer.close(index);

                var iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(iframeIndex);

                //table.reload('currentTableId',{});  //初始化表格
                window.parent.location.reload();  //刷新父页面
            });*/

            return false;
        });

    });
</script>
</body>
</html>